﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using KeRui.Common;
using System.Collections.Generic;
using System.Text;


public partial class Manage_System_FlagList : System.Web.UI.Page
{
    protected List<KeRui.Model.AdminFlag> listAdminFlag;
    private KeRui.BLL.AdminFlag bllAdminFlag = new KeRui.BLL.AdminFlag();
    protected int flagtype = -1;
    private ManageErrMsg nsb = new ManageErrMsg();
    protected void Page_Load(object sender, EventArgs e)
    {
        ManageHelper.CheckAdminLogin();//判断登录状态
        ManageHelper.CheckAdminPower("system_flag");//权限
        flagtype = PageRequest.GetInt("ft", 0);
    }
    int num = 0;
    protected string GetListP(int pID)
    {
        StringBuilder RetStr = new StringBuilder();
        listAdminFlag = bllAdminFlag.GetList(pID, flagtype);
        foreach (KeRui.Model.AdminFlag model in listAdminFlag)
        {
            RetStr.Append("<tr class=\"tdbg\" onmouseover=\"this.className='tdbg-dark';\" onmouseout=\"this.className='tdbg';\" style=\"height: 25px;\">");
            RetStr.Append("<td align=\"left\" style=\"padding-left:" + num * 34 + "px;\">&nbsp;<img src=\"../pic/menu/" + (model.Icon == "" || model.Icon == null ? "item.gif" : model.Icon) + "\"/> <font style=\"color:" + (model.IsNav == 1 ? "" : "#999999") + "\">" + (model.FlagName) + "</font></td>");
            RetStr.Append("<td align=\"left\">" + model.Flag + "</td>");
            //RetStr.Append("<td align=\"left\">" + model.AppUrl + "</td>");
            RetStr.Append("<td align=\"center\">" + model.OrderID + "</td>");
            RetStr.Append("<td align=\"center\">" + (model.IsOpen ? "是" : "<font style=\"color:green\">否</font>") + "</td>");
            RetStr.Append("<td align=\"center\">" + (model.IsNav == 1 ? "是" : "<font style=\"color:red\">否</font>") + "</td>");
            RetStr.Append("<td align=\"center\"><a href='FlagItem.aspx?id=" + model.ID + "&act=del&ft=" + model.FlagType + "' onClick=\"javascript:return confirm('此操作将会删除模块“" + model.FlagName + "”，确认吗？');\">删除</a>" +
                " | <a href=\"javascript:ymPrompt.win('FlagItem.aspx?act=edit&id=" + model.ID + "',450,390,'修改模块管理',null,null,null,true);\">编辑</a>" +
                " | <a href=\"javascript:ymPrompt.win('FlagItem.aspx?ft=" + flagtype + "&pId=" + model.ID + "',450,390,'修改模块管理',null,null,null,true);\">添加</a></td>");
            RetStr.Append("</tr>");
            if (model.HaveChildNav)
            {
                num++;
                RetStr.Append(GetListP(model.ID));
                num --;
            }
        }
        return RetStr.ToString();
    }

}
